<?php include "../public/header.php";?>
<?php include '../public/header_public.php' ?>
<style>
    html{overflow-x: hidden;}
    .seadiv{width:100%;margin: 10px 0 20px 1%}
    .seadiv #seabutton{background-color: #409EFF;border-radius: 4px;height: 36px;line-height: 36px;margin-left: 5px}
    #flowDiv{width: 100%;padding: 0 1%;}
    .ftits{height: 40px;line-height: 40px;background-color: #F5F5F5;margin-bottom: 15px;}
    .ftits span{margin-left: 10px}
    .fboxs{width: 100%;}
    .fboxs .box{width: 22%;margin-right: 3%;height: 91px;float: left;box-shadow:1px 1px 7px 2px #ccc;margin-bottom: 25px;
        position: relative;border-radius: 3px;border:1px solid #FFFFFF}
    .fboxs .box:nth-child(4),
    .fboxs .box:nth-child(8),
    .fboxs .box:nth-child(16){
        margin-right: 0;
    }
    .fboxs .box:hover{transform  : scale(1.03);cursor: pointer;}
    .fboxs .four{margin-right: 0}
    .fboxs .box .nums{width: 50px;height: 50px;font-size: 40px;line-height: 50px;background-color: #6ECFFA;color: #FFFFFF;
        font-weight: bold;text-align: center;border-radius: 3px;position: relative;left: 20px;top: 15px}
    .fboxs .box .numsoff{background-color: #eeeeee!important;}
    .fboxs .box .nameoff{color: #aaaaaa!important;}
    .fboxs .box .botinfo{height:35px;position: relative;bottom: -7px;background-color: #F0F6FF;color: #777777;line-height: 35px;border-radius: 3px;padding: 0 10px 0 20px;font-size: 12px}
    .fboxs .box .botinfo2{position: relative;bottom: 33px;color: #777777;font-size: 12px;text-align: center}
    .fboxs .box .name{margin-left:80px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;position: relative;top:-33px;font-weight: bold;padding-right: 10px}
    .fboxs .box .explain{margin-left:80px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;position: relative;top:-33px;padding-right: 10px;color: #777777}
    .fboxs .box .opt{position: absolute;right: 10px;color: #B9B9B9;font-size: 25px;top: 4px;cursor: pointer;z-index: 99}
    .fboxs .box .optlist{width: 75px;height: 70px;background-color: #FFFFFF;z-index: 99;text-align: center;display: none;
        top: 22px;position: absolute;right: 0;border-radius: 3px;box-shadow:1px 1px 7px 2px #ccc;font-size: 14px;color: #555}
    .fboxs .box .optlist .but{margin: 10px;0}
    .fboxs .box .optlist .but:hover{color: #409EFF!important;}
    .fboxs .box .optlist .but i{margin-right: 6px}
    .clear{clear: both}


    body::-webkit-scrollbar {
        width: 0;
    }
</style>
<body>
<form class="layui-form flow_opt_page">
    <div class="mainBox">
        <div class="title-box" style="position: fixed;top: 0">
            <span class="title">发起流程申请</span>
            <div class="move_title"></div>
            <div class="title-box-opt">
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
</form>
<div class="layui-card" style="background: none;padding-top: 50px">
    <div class="layui-card-body" style="padding: 10px 0;position: unset">
        <div id="flowDiv"></div>
    </div>
</div>
<script>
    layui.use(['laytp','button'], function() {
        var form = layui.form;
        layui.use(['laytp','button'], function() {
            var form = layui.form;
            facade.ajax({url: ask_flow_add_bill_list}).done(function(res){
                if (res['code'] === 2000) {
                    var data = res.data.data;
                    var butauth = res.data.butauth;
                    var str = ''
                    for (var key in data){
                        var children = data[key].children;
                        if(children.length < 1){
                            continue;
                        }
                        str += '<div class="ftits"><span><b>'+data[key].name+'（ '+children.length+' ）</b></span></div>';
                        str += '<div class="fboxs">';
                        for (var ii in children){
                            var nums = parseInt(ii)+1;

                            if(nums%4 == 0){
                                str += '<div class="box four" onclick="create_bill(\''+children[ii].modenum+'\','+children[ii].status+','+children[ii].ispublish+')">';
                            }else{
                                str += '<div class="box" onclick="create_bill(\''+children[ii].modenum+'\','+children[ii].status+','+children[ii].ispublish+')">';
                            }

                            if(children[ii].status > 0){
                                str += '<div class="nums">'+nums+'</div>';
                                str += '<div class="name">'+children[ii].name+'</div>';
                                str += '<div class="explain" title='+children[ii].explain+'>'+children[ii].explain+'</div>';
                                if(!children[ii].ispublish){
                                    str += '<div class="botinfo2">';
                                    str += '<span>未发布，请联系管理员发布审核流程</span>';
                                    str += '</div>';
                                }
                            }else{
                                str += '<div class="nums numsoff">'+nums+'</div>';
                                str += '<div class="name nameoff">'+children[ii].name+'<span>（已禁用）</span></div>';
                                str += '<div class="explain nameoff" title='+children[ii].explain+'>'+children[ii].explain+'</div>';
                                str += '<div class="botinfo2">';
                                str += '<span>已禁用，请联系管理员启用</span>';
                                str += '</div>';
                            }
                            str += '</div>';
                        }
                        str += '</div>';
                        str += '<div class="clear"></div>';
                    }
                    $("#flowDiv").html(str);
                }
                render_from();
            });
        });
    });


    function create_bill(modenum, status, ispublish) {
        if(status < 1){
            facade.error('该模块已禁用，请联系管理员启用');
            return false;
        }
        if(!ispublish){
            facade.error('该模块未发布流程，请联系管理员发布审核流程');
            return false;
        }
        openPageEdit('../'+modenum+'/flow_add.php?close=1');
    }


    function layer_close(){
        try {
            parent.layui.table.reload('datalist');
        }catch (e) {

        }
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
</script>
</body>
</html>
